<?php
	
	/**
	 * @see Bike_Js_Ext_form_button_Button
	 */
	require_once 'Bike/Js/Ext/form/button/Button.php';
	
	
	class Bike_Js_Ext_form_button_Submit extends Bike_Js_Ext_form_button_Button
	{
		protected function initDefaultSettings()
		{
			parent::initDefaultSettings();
		
			$js = $this->js();
			$this->setSettings(array(
				'text' => $this->translate('Button:Submit'),
				'formBind' => true,
				'disabled' => true,
			));
		}
		
		/**
		 * Get JS listeners click
		 *
		 * @return Bike_Js_Interface_Js object
		 */
		protected function getJsListenersClick()
		{
			if(!$this->getParamCache(__METHOD__))
			{
				$js = $this->js();
				$this->setParamCache(__METHOD__,
					$js->function()->_body(array(
						$js->_var($js->form)->_val($js->this->up('form')->getForm()),
						$js->if($js->form->isValid())->_body(array(
							$js->form->submit($js->Function->getPropertyAccessor('submit')),
						)),
					))->_param('submit', $js->Ext->form->submit->Submit)
				);
			}
			return $this->getParamCache(__METHOD__);
		}
	}
